package com.shanzmoo.db.sys.entity.dto;

import com.shanzmoo.db.sys.entity.UserEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * 门店用户保存对象
 *
 * @author Gzhao 2020/12/30
 */
@Data
@ApiModel(value = "门店用户保存对象")
public class UserOutletSaveDto {

    @NotNull(message = "用户名称不允许为空")
    @ApiModelProperty(name = "username", value = "用户名称" )
    private String username;

    @NotEmpty(message = "角色id列表不允许为空")
    @ApiModelProperty("角色id列表" )
    private List<Integer> roleIds;

    public static UserEntity converted(UserOutletSaveDto saveDto) {
        UserEntity userEntity = new UserEntity();
        userEntity.setUsername(saveDto.getUsername().trim());
        return userEntity;
    }
}
